<template>
	<view>
		<view class="content" style="box-sizing: border-box;">
			<u-cell-group style="margin-bottom: 10px;">
				<u-cell-item  title="我的权益数" :arrow="false">
					<view style="color: #FD8521;" slot="right-icon">
						<image style="width: 30px; height: 32px; vertical-align: -10px;" src="/static/ys.png"></image>	{{rights}}个
					</view>
				</u-cell-item>
			</u-cell-group>

			<!-- 正文内容 -->
			<view style=" background: #fff; overflow: hidden;">
				<view style="padding: 20px 0;">
					<u-section @click="click" :right="false" title="权益明细" sub-title=""></u-section>
				</view>

				<view>
					<u-cell-group>
						<u-cell-item v-for="(items,index) in yuList" :key="index" :title="items.memo" label="" :arrow="false">
							<view style="color: #FD8521;" slot="right-icon">
								{{items.type}}{{items.rigths}}
							</view>
						</u-cell-item>
					</u-cell-group>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
    import {
        rightLog
    } from "@/common/config/request.js"
    export default {
        data() {
            return {
                rights:"",//我的权益数
                pageNum:1,//页数
                totalPage:0,//总页数
                yuList:[],//数据
            }
        },
        onLoad(options) {
            this.rights=options.rights
            this.getRight()
        },
        methods: {
            getRight(){
                rightLog({}).then(res=>{
                    // console.log(res,'222222')
                    if(res.data.code==1){
                        this.totalPage=res.data.data.last_page
                        this.yuList=[...this.yuList,...res.data.data.data]
                    }
                })
            },
			click () {}
        },
        onReachBottom() {
            if(this.pageNum<this.totalPage){
                this.pageNum++
                this.getYU()
            }else{
                uni.showToast({
                    icon:'none',
                    title:'暂无更多数据'
                })
            }
        }
    }
</script>

<style>
	page{background: #f0f0f0;}
</style>
